<?php

namespace backend\models\form;

/**
 * This is the model class for table "xqlh_project_basic_info".
 *
 * @property string $uuid
 * @property integer $batch_id
 * @property string $department_id
 * @property string $project_name
 * @property string $main_industry
 * @property string $post_group
 * @property string $project_value
 * @property string $code
 * @property integer $status
 * @property string $create_time
 * @property string $update_time
 * @property string $create_users_id
 * @property string $update_users_id
 */
class FormProjectBasicInfo extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'form_project_basic_info';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['uuid', 'batch_id', 'department_id', 'project_name', 'main_industry', 'post_group', 'project_value', 'create_time', 'update_time', 'create_users_id', 'update_users_id'], 'required'],
            [['batch_id', 'status'], 'integer'],
            [['project_value', 'code'], 'string'],
            [['create_time', 'update_time'], 'safe'],
            [['uuid', 'department_id', 'create_users_id', 'update_users_id'], 'string', 'max' => 36],
            [['post_group', 'code'], 'string', 'max' => 50],
            [['project_name'], 'string', 'max' => 100],
            ["main_industry", function ($att) {
                $main_industry = $this->$att;
                if ($main_industry && count(explode(",", $main_industry)) > 3) {
                    $this->addError($att, $this->attributeLabels()[$att] . '不能超过三个');
                }
            }, "skipOnEmpty" => false],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'uuid' => 'Uuid',
            'batch_id' => '批次id|batch',
            'department_id' => '单位id(学校)|department',
            'project_name' => '项目名称',
            'main_industry' => '主要面向产业',
            'post_group' => '面向的职业岗位',
            'project_value' => '项目目标',
            'code' => '编号',
            'status' => '状态:1 使用;2 注销',
            'create_time' => '添加时间',
            'update_time' => '修改时间',
            'create_users_id' => '添加人',
            'update_users_id' => '修改人',
        ];
    }


}
